package com.xzc.java8.B_Stream.h_reduce;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;

public class MaxMinTest {

    public static void main(String[] args) {
        List<Integer> list0 = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9);
        Optional<Integer> max = list0.stream().reduce(Integer::max);
        max.ifPresent(System.out::println);

        Optional<Integer> min = list0.stream().reduce(Integer::min);
        min.ifPresent(System.out::println);
    }
}
